unit Td_PosScore_List;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, BaseDataListForm, cxGraphics, cxControls, cxLookAndFeels,
  cxLookAndFeelPainters, cxContainer, cxEdit, dxSkinsCore,
  dxSkinsDefaultPainters, cxStyles, dxSkinscxPCPainter,
  cxDataStorage, DB, cxDBData, Menus, DBActns,
  StdActns, ActnList, ImgList, cxClasses, cxGridCustomView,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid,
  cxLabel, ExtCtrls, MisString, YBDBCtrlSet,
  cxCheckBox, cxTextEdit, cxMaskEdit, cxDropDownEdit,
  StdCtrls, cxGridCustomPopupMenu, dxSkinsForm,
  cxNavigator,
  System.Actions, cxCustomData, cxFilter, cxData, cxGridPopupMenu, MemDS,
  DBAccess, Uni, System.ImageList, cxGridLevel, cxButtons, Vcl.ExtDlgs;

type
  TfrmTd_PosScore_List = class(TfrmBaseDataListForm)
    filid: TcxGridDBColumn;
    addpoint: TcxGridDBColumn;
    saleamt: TcxGridDBColumn;
    cutpoint: TcxGridDBColumn;
    backamt: TcxGridDBColumn;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }

 protected
   function AppendRecord: Boolean; override;
   function EditRecord: Boolean; override;
  public
    { Public declarations }
  end;

var
  frmTd_PosScore_List: TfrmTd_PosScore_List;

implementation

uses Td_PosScore_Edit, GlobalVar;

{$R *.dfm}

function TfrmTd_PosScore_List.AppendRecord: Boolean;
begin
  ShowEditForm(frmTd_PosScore_Edit, TfrmTd_PosScore_Edit, et_New);
  Result := True;
end;

function TfrmTd_PosScore_List.EditRecord: Boolean;
var
  bGridMode: Boolean;
  iCurrKeyID: integer;
begin
  iCurrKeyID := MainDataSource.DataSet.FieldByName(FKeyField).AsInteger;
  try
    SQLWait_CURSOR;
    MainDataGrid.ActiveView.BeginUpdate;
    bGridMode := MainDataGridDBTableView.DataController.DataModeController.GridMode;
    MainDataGridDBTableView.DataController.DataModeController.GridMode := True;
    MainDataSource.DataSet.Locate(FKeyField, iCurrKeyID, [loCaseInsensitive]);
    ShowEditForm(frmTd_PosScore_Edit, TfrmTd_PosScore_Edit, et_Modify);
    MainDataGridDBTableView.DataController.DataModeController.GridMode := bGridMode;
  finally
    MainDataGrid.ActiveView.EndUpdate;
    DEFAULT_CURSOR;
  end;
  Result := True;
end;


procedure TfrmTd_PosScore_List.FormCreate(Sender: TObject);
begin
  FKeyField := 'id';
  FCodeField := '';
  FTableName := 'td_posscore';
  inherited;
end;

end.
